#-*- codeing =vtf-8 -*-
#@Time : 2021/9/9 19:17
#@Author : 丁利利
#@File : plot.py
#@SOftware: PyCharm
'''
1. 使用lili.py 得到read.in
2. 执行a<read.in 命令
3. 生成res.dat数据集 
4. 执行plot.py文件
注意: 
1. res.dat文件每次重新运行需要删除
2. 想生成不同的图片 记得修改plot.py中的文件名
3. 如果isingxy.f90修改过以后 需要重新执行gfortran isingxy.f90 生成新的a.exe
'''

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import time



a=np.loadtxt('E.dat')
T = a[:,0]
energy = a[:,1]
arm = a[:,2]
asm = a[:,3]
susp = a[:,4]
ase = a[:,5]
ave = a[:,6]
speh = a[:,7]
tbr = a[:,8]
var = a[:,9]


plt.plot(a[:,0],a[:,1],'ro')
plt.xlabel('T')
plt.ylabel('energy')
#plt.savefig('metropolis_xy{}T.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}energy.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()

plt.plot(a[:,0],a[:,2],'ro')
plt.xlabel('T')
plt.ylabel('arm')
#plt.savefig('metropolis_xy{}arm.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}arm.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))



plt.show()


plt.plot(a[:,0],a[:,3],'ro')
plt.xlabel('T')
plt.ylabel('asm')
#plt.savefig('metropolis_xy{}susp.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}asm.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()

plt.plot(a[:,0],a[:,4],'ro')
plt.xlabel('T')
plt.ylabel('susp')
#plt.savefig('metropolis_xy{}ase.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}susp.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()

plt.plot(a[:,0],a[:,5],'ro')
plt.xlabel('T')
plt.ylabel('ase')
#plt.savefig('metropolis_xy{}ave.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}ase.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()

plt.plot(a[:,0],a[:,6],'ro')
plt.xlabel('T')
plt.ylabel('ave')
#plt.savefig('metropolis_xy{}speh.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}ave.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()   

plt.plot(a[:,0],a[:,7],'ro')
plt.xlabel('T')
plt.ylabel('speh')
#plt.savefig('metropolis_xy{}speh.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}speh.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show() 

plt.plot(a[:,0],a[:,8],'ro')
plt.xlabel('T')
plt.ylabel('tbr')

#plt.savefig('metropolis_xy{}tbr.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}tbr.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()

plt.plot(a[:,0],a[:,9],'ro')
plt.xlabel('T')
plt.ylabel('var')

#plt.savefig('metropolis_xy{}tbr.eps'.format(time.strftime("%Y-%m-%d:%S", time.localtime())))
plt.savefig('metropolis_xy{}var.jpg'.format(time.strftime("%Y%m%d%H%S", time.localtime())))


plt.show()
'''
df = pd.DataFrame({'T':T,'tbr':tbr})
ax = sns.relplot(x='T',y='aro',data=df)
'''